package com.example.demo.entity;

import org.babyfish.jimmer.sql.DissociateAction;
import org.babyfish.jimmer.sql.Entity;
import org.babyfish.jimmer.sql.GeneratedValue;
import org.babyfish.jimmer.sql.GenerationType;
import org.babyfish.jimmer.sql.Id;
import org.babyfish.jimmer.sql.JoinColumn;
import org.babyfish.jimmer.sql.Key;
import org.babyfish.jimmer.sql.ManyToOne;
import org.babyfish.jimmer.sql.OnDissociate;
import org.babyfish.jimmer.sql.Table;

@Entity
@Table(name = "biz_order_detail")
public interface OrderDetail {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    int id();

    @ManyToOne
    @JoinColumn(name = "order_id")
    @Key
    @OnDissociate(DissociateAction.DELETE)
    Order order();

    @ManyToOne
    @JoinColumn(name = "product_id")
    @Key
    Product product();

    int productCount();
}
